package com.defang.application;

import com.defangit.applicant.domain.TicketType;
import com.defangit.applicant.orm.TicketService;
import com.defangit.applicant.orm.TicketTypeService;

import javax.ws.rs.*;
import java.util.List;
@Path("ticketType")
public class TicketTypeResource {
    TicketTypeService ticketTypeService = new TicketTypeService();
    @GET@Produces("application/json")
    public List<TicketType> ticketType(@QueryParam("ttname")String ttname,
                                       @QueryParam("allowedTicket")Integer allowedTicket){
        return ticketTypeService.findAll()
                .ttName(ttname)
                .allowedTikcet(allowedTicket)
                .matchedAll();
    }
    @POST@Consumes("application/json")
    public boolean saveOrUpdateTicketType(@QueryParam("id") int id,List<TicketType> list){
        return ticketTypeService.saveOrUpdateTicketType(id,list);
    }
//    @POST
//    public TicketType addTicketType(TicketType ticketType){
//        return ticketTypeService.addTicketType(ticketType);
//    }
//    @POST
//    public TicketType updateTicketType(TicketType ticketType){
//        return ticketTypeService.updateTicketType(ticketType);
//    }
    @DELETE
    public boolean delTicketType(Integer ticketTypeid){
        return ticketTypeService.delTicketType(ticketTypeid);
    }
}
